<?php

/**
 * Licensee form base class.
 *
 * @method Licensee getObject() Returns the current form's model object
 *
 * @package    symfony
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseLicenseeForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'licensee_user_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('sfGuardUserProfile'), 'add_empty' => true)),
      'licensee_number'  => new sfWidgetFormInputText(),
      'lastname'         => new sfWidgetFormInputText(),
      'firstname'        => new sfWidgetFormInputText(),
      'category'         => new sfWidgetFormChoice(array('choices' => array('P' => 'P', 'B1' => 'B1', 'B2' => 'B2', 'M1' => 'M1', 'M2' => 'M2', 'C1' => 'C1', 'C2' => 'C2', 'J1' => 'J1', 'J2' => 'J2', 'J3' => 'J3', 'S' => 'S', 'V1' => 'V1', 'V2' => 'V2', 'V3' => 'V3', 'V4' => 'V4'))),
      'status'           => new sfWidgetFormChoice(array('choices' => array('joue' => 'joue', 'en repos' => 'en repos'))),
      'team_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Team'), 'add_empty' => true)),
      'club_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Club'), 'add_empty' => true)),
      'slug'             => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'licensee_user_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('sfGuardUserProfile'), 'required' => false)),
      'licensee_number'  => new sfValidatorInteger(),
      'lastname'         => new sfValidatorString(array('max_length' => 64)),
      'firstname'        => new sfValidatorString(array('max_length' => 64)),
      'category'         => new sfValidatorChoice(array('choices' => array(0 => 'P', 1 => 'B1', 2 => 'B2', 3 => 'M1', 4 => 'M2', 5 => 'C1', 6 => 'C2', 7 => 'J1', 8 => 'J2', 9 => 'J3', 10 => 'S', 11 => 'V1', 12 => 'V2', 13 => 'V3', 14 => 'V4'), 'required' => false)),
      'status'           => new sfValidatorChoice(array('choices' => array(0 => 'joue', 1 => 'en repos'), 'required' => false)),
      'team_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Team'), 'required' => false)),
      'club_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Club'), 'required' => false)),
      'slug'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'Licensee', 'column' => array('slug')))
    );

    $this->widgetSchema->setNameFormat('licensee[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Licensee';
  }

}
